package adv328;

import adv327.Sex;
import adv327.Student;

import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class ListDemo3 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        list.add("sss");
        list.add("ffff");
        for(String s:list){
            System.out.println(s);
        }
        //???list.add(3.66);//error
        List<Student> l2=new ArrayList<>();
        l2.add(new Student("王五",23, Sex.男));
        l2.add(new JavaStudent("王五",23, Sex.男));

        Student student = l2.get(0);
        System.out.println(student);
        System.out.println(">>>>>>>>>>>>>>>>>");
        List<? super Number> l3=new ArrayList<>();
        l3.add(35);
        l3.add(35.5);
        l3.add(35.5F);
        l3.add(352F);
        List<? super Student> l5=new ArrayList<>();
        l5.add(new Student("王安",21,Sex.男));
        l5.add(new JavaStudent("王安",21,Sex.男));
        //List<? extends Student> l4=new ArrayList<>();
        //l4.add(new Student("王安",21,Sex.男));

        a(new JavaStudent("wang",22,Sex.男));
        a(new Student("wang",22,Sex.男));
    }
    public static <T extends Student>   void a(T t){

    }
}
